# OpenCV-Rust 项目环境设置脚本
# 在项目目录中运行: .\setup_opencv_env.ps1

Write-Host "设置 OpenCV-Rust 环境..." -ForegroundColor Cyan

# 设置环境变量
$env:PKG_CONFIG_PATH = "/Users/licheng/Work/openmmlab_wl/opencv/build_arm64/install_arm64/lib/pkgconfig"
$env:OPENCV_LIB_PATH = "/Users/licheng/Work/openmmlab_wl/opencv/build_arm64/install_arm64/lib"
$env:OpenCV_DIR = "/Users/licheng/Work/openmmlab_wl/opencv/build_arm64/install_arm64"

Write-Host "环境变量设置完成!" -ForegroundColor Green
Write-Host "PKG_CONFIG_PATH: $env:PKG_CONFIG_PATH" -ForegroundColor Yellow

# 检查 libclang.dylib 是否存在
if (Test-Path "/usr/local/lib/libclang.dylib") {
    Write-Host "✓ libclang.dylib 符号链接存在" -ForegroundColor Green
} else {
    Write-Host "⚠ libclang.dylib 符号链接不存在，需要重新创建" -ForegroundColor Red
    Write-Host "运行: sudo ln -sf /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib /usr/local/lib/libclang.dylib" -ForegroundColor Yellow
}

Write-Host "现在可以运行 'cargo build' 了!" -ForegroundColor Green 